<nav>
  <ul class="pagination">
    {% if p.has_previous %}
      <li>
          <a href="javascript:void(0);" onclick="search_log2({{ page|add:-1 }})" aria-label="Previous">
              <span aria-hidden="true">&laquo;</span>
          </a>
      </li>
    {% endif %}

      {% for num in page_range %}
      <li {% ifequal num page %}class="active"{% endifequal %}><a  href="javascript:void(0);" onclick="search_log2({{ num }})">{{ num }}</a></li>
      {% endfor %}

    {% if p.has_next %}
      <li>
          <a href="javascript:void(0);" onclick="search_log2({{ page|add:1 }})" aria-label="Next">
              <span aria-hidden="true">&raquo;</span>
          </a>
      </li>
    {% endif %}
  </ul>
</nav>